//
//  HHLikeRecordViewController.m
//  WeCommunity
//
//  Created by HappyMilk 01 on 2017/8/11.
//  Copyright © 2017年 lzy. All rights reserved.
//

#import "HHLikeRecordViewController.h"

@interface HHLikeRecordViewController ()

@end

@implementation HHLikeRecordViewController

- (void)viewDidLoad {

    
    [super viewDidLoad];
    [self beginLoadingData];
}


-(void)setupUserInterface
{
    [super setupUserInterface];
    
    
    self.title = HH_LOC_STR(@"My praise");
}



-(void)loadingData
{
    NSDate * loadDate = nil;
    if (self.loadDataType == LoadDataType_LoadData) {
        loadDate = [self getLastDynamicObject:self.dataSource].createDate;
    }


    [[DynamicServer shared] loadMyselfLikeDynamicWithLoadDate:loadDate loadCount:20 complete:^(BOOL success, NSString *error, NSArray *dataArray) {
       
        if (success) {
            if (self.loadDataType == LoadDataType_ReLoadData) {
                [self.dataSource removeAllObjects];
            }
            [self.dataSource addObjectsFromArray:dataArray];
            if (dataArray.count == 0) {
                [self.footer setTitle:KHasLoadedAllTitle forState:MJRefreshStateIdle];
                [self.footer setTitle:KHasLoadedAllTitle forState:MJRefreshStateRefreshing];
            }else{
                [self.footer setTitle:KDragOrClickToDragTitle forState:MJRefreshStateIdle];
                [self.footer setTitle:KLoaddingMoreTitle forState:MJRefreshStateRefreshing];
            }
        }else{
            [UITool showHudWithText:error withView:self.view];
        }
        [self endRefreshAnimation:success];
    }];
}

@end
